#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n,m;
cin>>n>>m;
ll arr[n];
set<ll>s;
for(ll i=0;i<n;i++){
cin>>arr[i];
s.insert(arr[i]);
}
ll ans=1;
if(n>1000 || s.size()!=n){
cout<<0<<endl;
}
else {
bool flag=true;
for(ll i=0;i<n;i++){
for(ll j=i+1;j<n;j++){
ans=(ans*(abs(arr[j]-arr[i]))%m)%m;
// cout<<ans<<endl;
if(ans==0){
flag=false;
break;
}
}
if(flag==false)break;
}
cout<<ans<<endl;
}
}
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |